﻿Ext.define('Egitim.view.EgitmenList', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.egitmenlist',
    store: 'Egitmen',
	
	initComponent: function (){		
		var me = this;
        me.callParent();
		me.addEvents('silegitmen', 'guncelleegitmen');

	},
	
	dockedItems: [{
                    dock: 'top',
                    xtype: 'toolbar',
                    items: [{
                        glyph: 61,
                        xtype: 'button',
						handler: function () {
							this.up('panel').down('#searchform').setVisible(true);
						}
                    }, {
                        xtype: 'form',
						itemId: 'searchform',
						layout: 'hbox',
						border: false,
						hidden: true,
						defaultType: 'textfield',
						items: [{
							fieldLabel: 'Ad',
							name: 'ad',
							itemId: 'search'
						}]
                    }]
                },{
        xtype: 'pagingtoolbar',
        store: 'Egitmen',
        dock: 'bottom',
        displayInfo: true
    }],
	
	columns: [
	    { text: 'Kod',  dataIndex: 'kod'},
        { text: LBL_AD,  dataIndex: 'ad', flex: 1},
        { text: LBL_SOYAD,  dataIndex: 'soyad', flex: 2},
        { text: LBL_OLUSTURULDU, dataIndex: 'created'},
		{
            xtype:'actioncolumn',
            width:50,
            items: [{
                icon: 'egitimapp/resources/icons/edit.png',  // Use a URL in the icon config
                tooltip: LBL_GUNCELLE,
                handler: function(grid, rowIndex, colIndex) {
                    var rec = grid.getStore().getAt(rowIndex);
					grid.up('egitmenlist').fireEvent('guncelleegitmen', grid, rec);
                }
            },{
                icon: 'egitimapp/resources/icons/delete.gif',
                tooltip: LBL_SIL,
                handler: function(grid, rowIndex, colIndex) {
                    var rec = grid.getStore().getAt(rowIndex);
					grid.up('egitmenlist').fireEvent('silegitmen', grid, rec);
                }
            }]
        }		
    ]
    
});